import instance from '@/request/request'

//userInfo
export const GetUserInfoApi = (account) => {
  return instance({
    url: `/api/user/info/${account}`,
    method: 'get'
  })
}

//根据id获取用户信息
export const GetUserByIDApi = (id) => {
  return instance({
    url: `/api/user/getById/${id}`,
    method: 'get'
  })
}
//分页查询用户信息
export const GetUserListApi = (params) => {
  return instance({
    url: `/api/user/page`,
    method: 'get',
    params: params
  })
}
//修改用户状态
export const UpdateUserStatusApi = (id, status) => {
  return instance({
    url: `/api/user/updateStatus/${id}/${status}`,
    method: 'put',
  })
}
//删除用户
export const DeleteUserApi = (ids) => {
  return instance({
    url: `/api/user/delete`,
    method: 'delete',
    params: { ids }
  })
}
//修改用户信息
export const UpdateUserApi = (data) => {
  return instance({
    url: `/api/user/update`,
    method: 'put',
    data
  })
}
//重置用户密码
export const ResetUserPasswordApi=(id)=>{
  return instance({
    url:`/api/user/${id}`,
    method:'put'
  })
}
//添加新用户
export  const AddNewUserApi=(data)=>{
  return instance({
    url:`/api/user/add`,
    method:'post',
    data
  })
}
//根据名字
export const selectByName = (name) => {
  return instance({
    url: `/api/user/selectByName`,
    method: 'get',
    params:{name}
  })
}

export const updateUserPassword=(data)=>{
  return instance({
    url: `/api/user/updateUserPassword`,
    method: 'post',
    data
  })
}


export const initMyUserInfo = () => {
  return instance({
    url: `/api/user/getUserHomeInfo`,
    method: 'get'
  })
}
